<h1>Listing sites</h1>

<table>
  <tr>
    <th>Name</th>
    <th>Password</th>
    <th>Started</th>
    <th>Start time</th>
  </tr>

<% for site in @sites %>
  <% background = "white" %>
  <% background = "grey" if (site.started==true) and (site.finished? == true) %>
  <% background = "lightgreen" if (site.started==true) and (site.finished? != true) %>
  <tr style="background: <%= background %>;">
    <td><%=h site.name %></td>
    <td><%=h site.password %></td>
    <td><%=h site.started %></td>
    <td><%=h site.start_time %></td>
    <td><%= link_to 'Show', site %></td>
    <td><%= link_to 'Edit', edit_site_path(site) %></td>
    <td><%= link_to 'Destroy', site, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New site', new_site_path %>
